package com.example.IoCpractice;

import com.example.IoCpractice.Controller.UserController;
import com.example.IoCpractice.component.UserComponent;
import com.example.IoCpractice.model.UserInfo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;

@ComponentScan({"com.example.IoCpractice","com.example"})
@SpringBootApplication
public class  IoCpracticeApplication {

	public static void main(String[] args) {
		ApplicationContext context = SpringApplication.run(IoCpracticeApplication.class, args);
		/*UserController bean = context.getBean(UserController.class);
		bean.say();

		UserController userController = (UserController) context.getBean("userController");
		userController.say();

		UserController userController1 = context.getBean("userController", UserController.class);
		userController1.say();

		System.out.println(bean);
		System.out.println(userController);
		System.out.println(userController1);*/

		/*UserService userService = context.getBean(UserService.class);
		userService.say();

		UserRepository userRepository = context.getBean(UserRepository.class);
		userRepository.say();

		UserConfiguration userConfiguration = context.getBean(UserConfiguration.class);
		userRepository.say();

		UserComponent component = context.getBean(UserComponent.class);
		userRepository.say();*/


		/*UserInfo userInfo = (UserInfo) context.getBean("userInfo");
		System.out.println(userInfo);

		UserInfo userInfo1 = (UserInfo) context.getBean("userInfo1");
		System.out.println(userInfo1);*/


		/*UserInfo userInfo = (UserInfo) context.getBean("zhangsan");
		System.out.println(userInfo);

		UserInfo userInfo1 = (UserInfo) context.getBean("lisi");
		System.out.println(userInfo1);

		UserInfo userInfo2 = (UserInfo) context.getBean("wangwu");
		System.out.println(userInfo1);

		UserInfo userInfo2 = (UserInfo) context.getBean("userInfo2");
		System.out.println(userInfo2);

		UserComponent bean = context.getBean(UserComponent.class);
		bean.say();*/

	}

}

